<template>
  <div class="json-data clearfix">
    <el-scrollbar style="height: 100%">
    <div class="main">
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">格式化输出</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            const xiaoming = {<br>
                &nbsp;&nbsp;name: '小明',<br>
                &nbsp;&nbsp;age: 14,<br>
                &nbsp;&nbsp;'middle-school': '\"W3C\" Middle School',<br>
                &nbsp;&nbsp;skills: ['JavaScript', 'Java', 'Python', 'Lisp']<br>
            };<br>
            console.log(JSON.stringify(xiaoming, null, '  '));
          </code>
        </div>
      </el-card>
      <el-card class="box-card" shadow="hover">
        <div slot="header" class="clearfix">
          <span class="fs16">合并</span>
        </div>
        <div class="fs14 p10 lh20 text-left">
          <code>
            Object.assign(obj1,obj2);<br>
            // 浅copy(若有相同属性，后面的属性会覆盖前面的属性)
          </code>
        </div>
      </el-card>
    </div>
    </el-scrollbar>
  </div>
</template>

<script>
export default {
  name: 'JsonData'
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss">
.json-data{
  margin: 0 auto;
  overflow: hidden;
  .main{
    column-count: 2;
    column-gap:10px;
    padding: 10px;
  }
  .el-card{
    margin: 10px 0;
  }
  .el-card__header{
    padding: 0 10px;
    text-align: left;
    font-size: 14px;
    line-height: 30px;
    line-height: 30px;
  }
}
</style>
